package main

// 升序子数组的最大可能元素和
// 子数组：连续数字序列

func maxAscendingSum(nums []int) int {
	left := 0
	n := len(nums)
	res := 0
	for left < n {
		curSum := nums[left]
		right := left + 1
		for right < n && nums[right] > nums[right-1] {
			curSum += nums[right]
			right++
		}
		res = max(res, curSum)
		left = right
	}
	return res
}

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}
